﻿<div class="well with-header" ng-controller="ProvideHelpController">
    <div class="header bg-themeprimary">
        PH
        <div class="btn-group pull-right">
            <!--<span class="btn btn-sm" ng-click="popup('','AddOrderModal','AddOrderModalInstanceCtrl','sm')"><i class="fa fa-plus-circle"></i> Add</span>-->
        </div>
    </div>
    <div class="body">
        <div class="row">
            <div class="col-sm-12 padding-bottom-10">
                <alert type="{{AlertType}}" class="radius-bordered alert-shadowed" ng-if="messeger">
                    {{messeger}}
                </alert>
                <div class="form-group">
                    <div class="col-sm-7" style="padding: 0 5px 0 !important;">
                        <input type="text" class="form-control col-sm-8" id="txtPin" value="{{pinPH}}" readonly >
                    </div>
                    <div class="col-sm-3" style="padding: 0 !important;">
                        <button type="button" ng-click="pushPin(pinPH)" confirm="Are you sure confirm this ?" class="btn btn-blue">PH Now</button>
                    </div>

                </div>
            </div>
            <div class="col-sm-12" style="overflow-y:hidden">
                <table class="table table-bordered table-striped table-condensed flip-content">
                    <thead class="flip-content bordered-palegreen">
                        <tr>
                            <th width="1%">#</th>
                            <th>Create Date</th>
                            <th width="10%">Status</th>
                            <th>Value</th>
                            <th>GH User</th>
                            <th>GH Mobile</th>
                            <th>Remaining</th>
                            <th>Action</th>
                        </tr>
                    </thead>
                    <tbody ng-repeat="data in List" ng-show="List.length != 0" style="border:1px solid #ccc !important;">
                        <tr ng-style="data.Status === 0 && {'background-color':'white'} ||data.Status == 1 && {'background-color':'#9DFFB0'} ||data.Status == 2 && {'background-color':'#FFB74D'} || data.Status == 3 && {'background-color':'#9DFFB0'}">
                            <td class="numeric">{{$index+1}}</td>
                            <td>{{data.CreateDate}}</td>
                            <td>
                                {{data.StatusName}}
                            </td>
                            <td>{{data.Amount|number}}</td>
                            <td></td>
                            <td></td>
                            <td>{{data.Remaining}}</td>
                            <td></td>
                        </tr>                     
                        <tr ng-repeat="item in data.TransferOrder" ng-show="data.TransferOrder.length != 0" ng-style="item.Status == 2 && {'background-color':'#c4ffcf'} || item.Status == 1 && {'background-color':'#FFE0B2'}">
                            <td class="numeric"></td>
                            <td>{{item.CreateDate | amUtc | amDateFormat:'DD/MM/YYYY HH:mm:ss A'}}</td>
                            <td>
                                <span ng-if="item.Status == 0 && item.ShowConfirm == false">Proccesing</span>
                                <span ng-if="item.Status == 0 && item.ShowConfirm == true">Confirmed</span>
                                <span ng-if="item.Status == 1">Bad</span>
                                <span ng-if="item.Status == 2">Complete</span>
                            </td>
                            <td>{{item.Amount|number}}</td>
                            <td>{{item.GH_Name}}</td>
                            <td>{{item.GH_Mobile}}</td>
                            <td>{{item.Remaining}}</td>
                            <td>
                                <a href="#" class="at-view" title="View detail" ng-click="popup('','FormGHViewModal','GHViewModalInstanceCtrl','lg',{{item.UserGH}},{{item.Id}})"> View</a> 
                                <a href="#" class="at-confirm" ng-if="item.Status != 5" title="View detail" ng-click="popup('','FormConfirmTransferPHModal','ConfirmTransferPHModalInstanceCtrl','lg',{{item.Id}})"> Confirm PH</a> 
                                <a href="#" class="at-bad" ng-if="item.Remaining == '0'" title="Bad report" ng-click="popup('','FormBadReportGHModal','ReportGHModalInstanceCtrl','lg',{{item.Id}})"> Report</a>
                            </td>
                        </tr>
                    </tbody>
                </table>
            </div>
        </div>
    </div>
    <!--Success Modal Templates-->
    <script type="text/ng-template" id="WarningModal">
        <div class="modal-header">
            <i class="glyphicon glyphicon-warning-sign"></i>
        </div>
        <div class="modal-title">{{title}}</div>
        <div class="modal-body">
            {{ messeger }}
        </div>
        <div class="modal-footer">
            <button type="button" class="btn btn-success" ng-click="ok()">OK</button>
            <button type="button" class="btn btn-default" ng-click="cancel()">Cancel</button>
        </div>
    </script>
</div>
 <!--- View GH --->
<script type="text/ng-template" id="FormGHViewModal">
    <div class="modal-header">
        <strong>GH User Information</strong>
    </div>
    <div class="modal-body">
        <p class="text-danger">{{messeger}}</p>
        <div class="row">
            <div class="col-md-6">
                <div class="form-group">
                    <label style="width:30%;font-weight:bold;text-align:right;">GH User :</label>
                    <label>{{user.UserName}}</label>
                </div>
                <div class="form-group">
                    <label style="width:30%;font-weight:bold;text-align:right;">GH Full Name :</label>
                    <label>{{user.HoTen}}</label>
                </div>
                <div class="form-group">
                    <label style="width:30%;font-weight:bold;text-align:right;">GH Mobile :</label>
                    <label>{{user.SDTNHARIENG}}</label>
                </div>
                <div class="form-group">
                    <label style="width:30%;font-weight:bold;text-align:right;">GH Bank Number :</label>
                    <label>{{user.SoTaiKhoan}}</label>
                </div>
                <div class="form-group">
                    <label style="width:30%;font-weight:bold;text-align:right;">GH Bank Name :</label>
                    <label>{{user.BankName}}</label>
                </div>
            </div>
            <div class="col-md-6">
                <div class="form-group">
                    <label style="width:30%;font-weight:bold;text-align:right;">Upline User :</label>
                    <label>{{parent.UserName}}</label>
                </div>
                <div class="form-group">
                    <label style="width:30%;font-weight:bold;text-align:right;">Upline Full Name :</label>
                    <label>{{parent.HOTEN}}</label>
                </div>
                <div class="form-group">
                    <label style="width:30%;font-weight:bold;text-align:right;">Upline Mobile :</label>
                    <label>{{parent.SDTNHARIENG}}</label>
                </div>
            </div>
            <br style="clear:both" />
            <p style="width:100%; font-size:15px; text-indent:2%;background-color:#F5F5F5;line-height:30px; font-weight:bold;"> Review image</p>
            <div class="col-md-6" style="max-height:200px;overflow-y:scroll;width:99%;">
                <img src="{{imagePH}}" class="img-responsive" style="max-width:850px !important;vertical-align:middle;text-align:left;" />
            </div>
        </div>
    </div>
    <div class="modal-footer">
        <button class="btn btn-default" ng-click="cancel()" data-dismiss="modal">Close</button>
    </div>
</script>
<!---/View GH --->
<!--- Bad Report GH --->
<script type="text/ng-template" id="FormBadReportGHModal">
    <div class="modal-header">
        <strong>Report GH</strong>
    </div>
    <div class="modal-body">
        <p class="text-danger">{{messeger}}</p>
        <form name="BadPH" method="post" class="bv-form" novalidate>
            <div class="row">
                <div>
                    <div class="form-group">
                        <label style="width:30%;font-weight:bold;text-align:right;">GH User :</label>
                        <label>{{trans.GH_Name}}</label>
                    </div>
                    <div class="form-group">
                        <label style="width:30%;font-weight:bold;text-align:right;">GH Mobile :</label>
                        <label>{{trans.GH_Mobile}}</label>
                    </div>
                    <div class="form-group">
                        <label style="width:30%;font-weight:bold;text-align:right; vertical-align:top;">Reason :</label>
                        <textarea ng-model="desc" placeholder="Content" style="background-color:white !important;width:60%!important;"></textarea>
                    </div>
                </div>
            </div>
        </form>
    </div>
    <div class="modal-footer">
        <span ng-if="processing" class="text-success"><i class="fa fa-circle-o-notch fa-spin"></i></span>
        <button type="button" class="btn btn-success" ng-click="doReport(trans.Id,desc)" ng-disabled="processing">Submit</button>
        <button class="btn btn-default" ng-click="cancel()" data-dismiss="modal">Close</button>
    </div>
</script>
<!---/Bad Report GH --->
<!--- Confirm has Transfer --->
<script type="text/ng-template" id="FormConfirmTransferPHModal">
    <div class="modal-header">
        <strong>Confirm PH</strong>
        <strong id="msg" style="font-size:16px;margin-left:30%;color:orangered !important;"></strong>
        <button type="button" class="close" data-dismiss="modal" aria-label="Close" ng-click="cancel()"><span aria-hidden="true">&times;</span></button>
    </div>
    <div class="modal-body">
        <form name="ConfirmPH" method="post" class="bv-form" novalidate>
            <div class="row">
                <div>
                    <div class="form-group">
                        <label style="width:15%;font-weight:bold;text-align:right; vertical-align:top;">Reason :</label>
                        <textarea ng-model="desc2" placeholder="Content" style="background-color:white !important;width:80%!important;"></textarea>
                    </div>
                    <div class="form-group">
                        <label style="width:15%;font-weight:bold;text-align:right;">Image upload :</label>
                        <input name="uploadFile" id="myfile"  type="file" style="display:inline-block !important;" />
                    </div>
                </div>
            </div>
        </form>
    </div>
    <div class="modal-footer">
        <span ng-if="processing" class="text-success"><i class="fa fa-circle-o-notch fa-spin"></i></span>
        <button type="button" class="btn btn-success" ng-click="doConfirm(desc2)" ng-disabled="processing">Submit</button>
        <button class="btn btn-default" ng-click="cancel()" data-dismiss="modal">Close</button>
    </div>
</script>
<!---/Confirm has Transfer --->
<script type="text/ng-template" id="AddOrderModal">
    <div class="modal-header">
        <strong>Add Order</strong>
    </div>
    <div class="modal-body">
        <div class="loginbox">
            <p class="text-danger">{{messeger}}</p>
            <form name="simpleForm" method="post" class="bv-form" novalidate="novalidate">
                <div class="form-group">
                    <label>Amount :</label>
                    <ui-select ng-model="package.selected">
                        <ui-select-match placeholder="Select or search a Amount in the list...">
                            {{$select.selected.Amount}}
                        </ui-select-match>
                        <ui-select-choices repeat="item in AmountList | filter: $select.search">
                            <span ng-bind="item.Amount"></span>
                        </ui-select-choices>
                    </ui-select>
                    {{data.Amount = package.selected.Amount;""}}
                    <!--<div class="form-group">
                        <label>
                           1 <i class="fa fa-bitcoin"></i> = <i class="fa fa-usd"></i> {{rate}}
                        </label>
                    </div>-->
                </div>
                <div class="form-group">
                    <label>Pin code :</label>
                    <input class="form-control" ng-model="data.PinCode" type="text">
                    </div>
                </div>
            </form>
        </div>
    </div>
    <div class="modal-footer">
        <span ng-if="processing" class="text-success"><i class="fa fa-circle-o-notch fa-spin"></i></span>
        <button type="button" class="btn btn-success" ng-click="doAddOrder(data)">Submit</button>
        <button type="button" class="btn btn-default" ng-click="cancel()">Cancel</button>
    </div>
</script>